<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    
    <title>Data type routines &mdash; NumPy v1.18 Manual</title>
    
    <link rel="stylesheet" type="text/css" href="../_static/css/spc-bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../_static/css/spc-extend.css">
    <link rel="stylesheet" href="../_static/scipy.css" type="text/css" >
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" >
    <link rel="stylesheet" href="../_static/graphviz.css" type="text/css" >
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.18.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script type="text/javascript" src="../_static/js/copybutton.js"></script>
    <link rel="author" title="About these documents" href="../about.html" >
    <link rel="index" title="Index" href="../genindex.html" >
    <link rel="search" title="Search" href="../search.html" >
    <link rel="top" title="NumPy v1.18 Manual" href="../index.html" >
    <link rel="up" title="Routines" href="routines.html" >
    <link rel="next" title="numpy.can_cast" href="generated/numpy.can_cast.html" >
    <link rel="prev" title="numpy.busday_count" href="generated/numpy.busday_count.html" > 
  </head>
  <body>
<div class="container">
  <div class="top-scipy-org-logo-header" style="background-color: #a2bae8;">
    <a href="../index.html">
      <img border=0 alt="NumPy" src="../_static/numpy_logo.png"></a>
    </div>
  </div>
</div>


    <div class="container">
      <div class="main">
        
	<div class="row-fluid">
	  <div class="span12">
	    <div class="spc-navbar">
              
    <ul class="nav nav-pills pull-left">
        <li class="active"><a href="https://numpy.org/">NumPy.org</a></li>
        <li class="active"><a href="https://numpy.org/doc">Docs</a></li>
        
        <li class="active"><a href="../index.html">NumPy v1.18 Manual</a></li>
        

          <li class="active"><a href="index.html" >NumPy Reference</a></li>
          <li class="active"><a href="routines.html" accesskey="U">Routines</a></li> 
    </ul>
              
              
    <ul class="nav nav-pills pull-right">
      <li class="active">
        <a href="../genindex.html" title="General Index"
           accesskey="I">index</a>
      </li>
      <li class="active">
        <a href="generated/numpy.can_cast.html" title="numpy.can_cast"
           accesskey="N">next</a>
      </li>
      <li class="active">
        <a href="generated/numpy.busday_count.html" title="numpy.busday_count"
           accesskey="P">previous</a>
      </li>
    </ul>
              
	    </div>
	  </div>
	</div>
        

	<div class="row-fluid">
      <div class="spc-rightsidebar span3">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Data type routines</a><ul>
<li><a class="reference internal" href="#creating-data-types">Creating data types</a></li>
<li><a class="reference internal" href="#data-type-information">Data type information</a></li>
<li><a class="reference internal" href="#data-type-testing">Data type testing</a></li>
<li><a class="reference internal" href="#miscellaneous">Miscellaneous</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="generated/numpy.busday_count.html"
                        title="previous chapter">numpy.busday_count</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="generated/numpy.can_cast.html"
                        title="next chapter">numpy.can_cast</a></p>
<div id="searchbox" style="display: none" role="search">
  <h4>Quick search</h4>
    <div>
    <form class="search" action="../search.html" method="get">
      <input type="text" style="width: inherit;" name="q" />
      <input type="submit" value="search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
          <div class="span9">
            
        <div class="bodywrapper">
          <div class="body" id="spc-section-body">
            
  <div class="section" id="data-type-routines">
<span id="routines-dtype"></span><h1>Data type routines<a class="headerlink" href="#data-type-routines" title="Permalink to this headline">¶</a></h1>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.can_cast.html#numpy.can_cast" title="numpy.can_cast"><code class="xref py py-obj docutils literal notranslate"><span class="pre">can_cast</span></code></a>(from_, to[, casting])</p></td>
<td><p>Returns True if cast between data types can occur according to the casting rule.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.promote_types.html#numpy.promote_types" title="numpy.promote_types"><code class="xref py py-obj docutils literal notranslate"><span class="pre">promote_types</span></code></a>(type1, type2)</p></td>
<td><p>Returns the data type with the smallest size and smallest scalar kind to which both <code class="docutils literal notranslate"><span class="pre">type1</span></code> and <code class="docutils literal notranslate"><span class="pre">type2</span></code> may be safely cast.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.min_scalar_type.html#numpy.min_scalar_type" title="numpy.min_scalar_type"><code class="xref py py-obj docutils literal notranslate"><span class="pre">min_scalar_type</span></code></a>(a)</p></td>
<td><p>For scalar <code class="docutils literal notranslate"><span class="pre">a</span></code>, returns the data type with the smallest size and smallest scalar kind which can hold its value.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.result_type.html#numpy.result_type" title="numpy.result_type"><code class="xref py py-obj docutils literal notranslate"><span class="pre">result_type</span></code></a>(*arrays_and_dtypes)</p></td>
<td><p>Returns the type that results from applying the NumPy type promotion rules to the arguments.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.common_type.html#numpy.common_type" title="numpy.common_type"><code class="xref py py-obj docutils literal notranslate"><span class="pre">common_type</span></code></a>(\*arrays)</p></td>
<td><p>Return a scalar type which is common to the input arrays.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.obj2sctype.html#numpy.obj2sctype" title="numpy.obj2sctype"><code class="xref py py-obj docutils literal notranslate"><span class="pre">obj2sctype</span></code></a>(rep[, default])</p></td>
<td><p>Return the scalar dtype or NumPy equivalent of Python type of an object.</p></td>
</tr>
</tbody>
</table>
<div class="section" id="creating-data-types">
<h2>Creating data types<a class="headerlink" href="#creating-data-types" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.dtype.html#numpy.dtype" title="numpy.dtype"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dtype</span></code></a>(obj[, align, copy])</p></td>
<td><p>Create a data type object.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.format_parser.html#numpy.format_parser" title="numpy.format_parser"><code class="xref py py-obj docutils literal notranslate"><span class="pre">format_parser</span></code></a>(formats, names, titles[, …])</p></td>
<td><p>Class to convert formats, names, titles description to a dtype.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="data-type-information">
<h2>Data type information<a class="headerlink" href="#data-type-information" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.finfo.html#numpy.finfo" title="numpy.finfo"><code class="xref py py-obj docutils literal notranslate"><span class="pre">finfo</span></code></a>(dtype)</p></td>
<td><p>Machine limits for floating point types.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.iinfo.html#numpy.iinfo" title="numpy.iinfo"><code class="xref py py-obj docutils literal notranslate"><span class="pre">iinfo</span></code></a>(type)</p></td>
<td><p>Machine limits for integer types.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.MachAr.html#numpy.MachAr" title="numpy.MachAr"><code class="xref py py-obj docutils literal notranslate"><span class="pre">MachAr</span></code></a>([float_conv, int_conv, …])</p></td>
<td><p>Diagnosing machine parameters.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="data-type-testing">
<h2>Data type testing<a class="headerlink" href="#data-type-testing" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.issctype.html#numpy.issctype" title="numpy.issctype"><code class="xref py py-obj docutils literal notranslate"><span class="pre">issctype</span></code></a>(rep)</p></td>
<td><p>Determines whether the given object represents a scalar data-type.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.issubdtype.html#numpy.issubdtype" title="numpy.issubdtype"><code class="xref py py-obj docutils literal notranslate"><span class="pre">issubdtype</span></code></a>(arg1, arg2)</p></td>
<td><p>Returns True if first argument is a typecode lower/equal in type hierarchy.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.issubsctype.html#numpy.issubsctype" title="numpy.issubsctype"><code class="xref py py-obj docutils literal notranslate"><span class="pre">issubsctype</span></code></a>(arg1, arg2)</p></td>
<td><p>Determine if the first argument is a subclass of the second argument.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.issubclass_.html#numpy.issubclass_" title="numpy.issubclass_"><code class="xref py py-obj docutils literal notranslate"><span class="pre">issubclass_</span></code></a>(arg1, arg2)</p></td>
<td><p>Determine if a class is a subclass of a second class.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.find_common_type.html#numpy.find_common_type" title="numpy.find_common_type"><code class="xref py py-obj docutils literal notranslate"><span class="pre">find_common_type</span></code></a>(array_types, scalar_types)</p></td>
<td><p>Determine common type following standard coercion rules.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="miscellaneous">
<h2>Miscellaneous<a class="headerlink" href="#miscellaneous" title="Permalink to this headline">¶</a></h2>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.typename.html#numpy.typename" title="numpy.typename"><code class="xref py py-obj docutils literal notranslate"><span class="pre">typename</span></code></a>(char)</p></td>
<td><p>Return a description for the given data type code.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.sctype2char.html#numpy.sctype2char" title="numpy.sctype2char"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sctype2char</span></code></a>(sctype)</p></td>
<td><p>Return the string representation of a scalar dtype.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.mintypecode.html#numpy.mintypecode" title="numpy.mintypecode"><code class="xref py py-obj docutils literal notranslate"><span class="pre">mintypecode</span></code></a>(typechars[, typeset, default])</p></td>
<td><p>Return the character for the minimum-size type to which given types can be safely cast.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.maximum_sctype.html#numpy.maximum_sctype" title="numpy.maximum_sctype"><code class="xref py py-obj docutils literal notranslate"><span class="pre">maximum_sctype</span></code></a>(t)</p></td>
<td><p>Return the scalar type of highest precision of the same kind as the input.</p></td>
</tr>
</tbody>
</table>
</div>
</div>


          </div>
        </div>
          </div>
        </div>
      </div>
    </div>

    <div class="container container-navbar-bottom">
      <div class="spc-navbar">
        
      </div>
    </div>
    <div class="container">
    <div class="footer">
    <div class="row-fluid">
    <ul class="inline pull-left">
      <li>
        &copy; Copyright 2008-2019, The SciPy community.
      </li>
      <li>
      Last updated on Feb 20, 2020.
      </li>
      <li>
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.4.2.
      </li>
    </ul>
    </div>
    </div>
    </div>
  </body>
</html>